package com.example.treinamentotiroaoalvo;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.ImageButton;

public class MenuActivity extends Activity {

	public ImageButton playButton;
	public ImageButton creditsButton;
	private ImageButton honraEPoder;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
		
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
		WindowManager.LayoutParams.FLAG_FULLSCREEN);
		
		setContentView(R.layout.activity_menu);
		
		playButton = (ImageButton) findViewById(R.id.imageButton_play);
		playButton.setOnClickListener(new OnClickListener() 
		{
			@Override public void onClick(View arg0) 
			{
				SoundManager.getInstance().playSound(R.raw.shootsound, getApplicationContext());	
				Intent gameSceneIntent = new Intent(getApplicationContext(), MainActivity.class);
				startActivity(gameSceneIntent);
			}
		});
		
		creditsButton = (ImageButton) findViewById(R.id.imageButton_credits);
		creditsButton.setOnClickListener(new OnClickListener() 
		{
			
			@Override public void onClick(View v) 
			{
				SoundManager.getInstance().playSound(R.raw.shootsound, getApplicationContext());
				Intent gameSceneIntent = new Intent(getApplicationContext(), CreditsActivity.class);
				startActivity(gameSceneIntent);
			}
		});
		
		honraEPoder = (ImageButton) findViewById(R.id.imageButton_honraEPoder);
		honraEPoder.setOnClickListener(new  OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(Intent.ACTION_VIEW);
				intent.setData(Uri.parse("market://details?id=com.nave.segundaguerra"));
				startActivity(intent);
			}
		});
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) 
	{
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_menu, menu);
		return true;
	}

}
